package com.zyz.bookborrowing.service;

import com.zyz.bookborrowing.bean.Book;
import com.zyz.bookborrowing.bean.PageBean;
import com.zyz.bookborrowing.dao.BookDaoImpl;
import com.zyz.bookborrowing.dao.BookDaoImpl2;
import com.zyz.bookborrowing.dao.IBookDao;
import com.zyz.bookborrowing.dao.IBookDao2;
import com.zyz.bookborrowing.utils.DelFlagE;
import com.zyz.bookborrowing.utils.MyDButils;
import org.apache.commons.dbutils.DbUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.ResultSetHandler;
import org.apache.commons.dbutils.handlers.ScalarHandler;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class BookServiceImpl implements IBookService{

    private IBookDao2 bookDao = new BookDaoImpl2();


    @Override
    public List<Book> list(Book book) {
        return bookDao.list(book);
    }

    @Override
    public Integer save(Book book) {
        return bookDao.save(book);
    }

    @Override
    public Integer updateBook(Book book) {
        return bookDao.updateBook(book);
    }

    @Override
    public Integer deleteById(Integer id) {
        return bookDao.deleteById(id);
    }

    @Override
    public Book queryById(Integer id) {
        return bookDao.queryById(id);
    }

    @Override
    public List<Book> queryListByState(int code) {
        return bookDao.queryListByState(code);
    }



    public long getTotalCount(){
        return bookDao.getTotalCount();
    }

    public PageBean<Book> queryAll(String no) {
        return bookDao.queryAll(no);
    }




}
